#import "AppDelegate.h"
#import "AutohideDock.h"

@implementation AppDelegate
{
    AutohideDock* mAutohideDock;
}

//应用完成启动时
- (void)applicationDidFinishLaunching:(NSNotification* )notification
{
    //实例化AutohideDock
    //程序菜单加入到Mac状态栏
    //监听全局Function键
    //隐藏Dock
    //设置自动隐藏Dock延时的值，此项必须设置
    //设置自动隐藏Dock动画的值，此项如果想保留动画，可以注释
    //重启Dock
    mAutohideDock = [[AutohideDock alloc] init];
    [mAutohideDock addStatusBarMenu];
    [mAutohideDock addMonitor];
    [mAutohideDock setAutohide:YES];
    [mAutohideDock setAutohideDelay];
    //[mAutohideDock setAutohideTimeModifier];
    [mAutohideDock resetDock];
}

//应用将退出时
- (void)applicationWillTerminate:(NSNotification* )notification
{
    //移除监听全局Function键
    //恢复自动隐藏Dock延时和动画，同时取消自动隐藏Dock
    //重启Dock
    [mAutohideDock removeMonitor];
    [mAutohideDock resetAutohideDelayAndTimeModifier];
    [mAutohideDock resetDock];
}

@end
